.class public Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;
.super Landroid/widget/SimpleCursorAdapter;
.source "PostViewGalleryAdapter.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;
    }
.end annotation


# static fields
.field public static final DEBUG:Z

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private activity:Landroid/app/Activity;

.field private imageManager:Lcom/opongo/blogapp/manager/ImageManager;

.field private imageurlIndex:I

.field private mInflater:Landroid/view/LayoutInflater;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 21
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->DEBUG:Z

    .line 22
    const-class v0, Lcom/opongo/blogapp/adapter/PostListAdapter;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->TAG:Ljava/lang/String;

    .line 18
    return-void
.end method

.method public constructor <init>(Landroid/app/Activity;Landroid/content/Context;ILandroid/database/Cursor;[Ljava/lang/String;[I)V
    .locals 6
    .parameter "activity"
    .parameter "context"
    .parameter "layoutId"
    .parameter "cursor"
    .parameter "columnNames"
    .parameter "columnIds"

    .prologue
    .line 33
    move-object v0, p0

    move-object v1, p2

    move v2, p3

    move-object v3, p4

    move-object v4, p5

    move-object v5, p6

    invoke-direct/range {v0 .. v5}, Landroid/widget/SimpleCursorAdapter;-><init>(Landroid/content/Context;ILandroid/database/Cursor;[Ljava/lang/String;[I)V

    .line 36
    invoke-static {p2}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->mInflater:Landroid/view/LayoutInflater;

    .line 38
    iput-object p1, p0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->activity:Landroid/app/Activity;

    .line 44
    const-string v0, "imageurl"

    invoke-interface {p4, v0}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->imageurlIndex:I

    .line 45
    new-instance v0, Lcom/opongo/blogapp/manager/ImageManager;

    invoke-direct {v0, p2}, Lcom/opongo/blogapp/manager/ImageManager;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->imageManager:Lcom/opongo/blogapp/manager/ImageManager;

    .line 46
    return-void
.end method


# virtual methods
.method public bindView(Landroid/view/View;Landroid/content/Context;Landroid/database/Cursor;)V
    .locals 6
    .parameter "view"
    .parameter "context"
    .parameter "cursor"

    .prologue
    const v5, 0x7f020018

    .line 93
    invoke-virtual {p1}, Landroid/view/View;->getTag()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;

    .line 96
    .local v1, viewHolder:Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;
    iget v2, p0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->imageurlIndex:I

    invoke-interface {p3, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v0

    .line 97
    .local v0, imgUrl:Ljava/lang/String;
    #getter for: Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;->mThumbImg:Landroid/widget/ImageView;
    invoke-static {v1}, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;->access$1(Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;)Landroid/widget/ImageView;

    move-result-object v2

    if-eqz v2, :cond_3

    .line 98
    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v2

    const/16 v3, 0xa

    if-le v2, v3, :cond_1

    .line 99
    #getter for: Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;->mThumbImg:Landroid/widget/ImageView;
    invoke-static {v1}, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;->access$1(Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;)Landroid/widget/ImageView;

    move-result-object v2

    invoke-virtual {v2, v5}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 100
    iget-object v2, p0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->imageManager:Lcom/opongo/blogapp/manager/ImageManager;

    iget-object v3, p0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->activity:Landroid/app/Activity;

    #getter for: Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;->mThumbImg:Landroid/widget/ImageView;
    invoke-static {v1}, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;->access$1(Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;)Landroid/widget/ImageView;

    move-result-object v4

    invoke-virtual {v2, v0, v3, v4}, Lcom/opongo/blogapp/manager/ImageManager;->displayImage(Ljava/lang/String;Landroid/app/Activity;Landroid/widget/ImageView;)V

    .line 108
    :cond_0
    :goto_0
    return-void

    .line 102
    :cond_1
    sget-boolean v2, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->DEBUG:Z

    if-eqz v2, :cond_2

    sget-object v2, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->TAG:Ljava/lang/String;

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "Image url to short to be valid: "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 103
    :cond_2
    #getter for: Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;->mThumbImg:Landroid/widget/ImageView;
    invoke-static {v1}, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;->access$1(Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;)Landroid/widget/ImageView;

    move-result-object v2

    invoke-virtual {v2, v5}, Landroid/widget/ImageView;->setImageResource(I)V

    goto :goto_0

    .line 106
    :cond_3
    sget-boolean v2, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->DEBUG:Z

    if-eqz v2, :cond_0

    sget-object v2, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->TAG:Ljava/lang/String;

    const-string v3, "Thumbnail holder is null!"

    invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method public newView(Landroid/content/Context;Landroid/database/Cursor;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 5
    .parameter "context"
    .parameter "cursor"
    .parameter "parent"

    .prologue
    .line 68
    iget-object v2, p0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->mInflater:Landroid/view/LayoutInflater;

    const v3, 0x7f030009

    .line 69
    const/4 v4, 0x0

    .line 68
    invoke-virtual {v2, v3, p3, v4}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v0

    .line 72
    .local v0, view:Landroid/view/View;
    new-instance v1, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;

    invoke-direct {v1}, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;-><init>()V

    .line 77
    .local v1, viewHolder:Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;
    const v2, 0x7f080025

    invoke-virtual {v0, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/ImageView;

    #setter for: Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;->mThumbImg:Landroid/widget/ImageView;
    invoke-static {v1, v2}, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;->access$0(Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter$ViewHolder;Landroid/widget/ImageView;)V

    .line 80
    invoke-virtual {v0, v1}, Landroid/view/View;->setTag(Ljava/lang/Object;)V

    .line 82
    return-object v0
.end method

.method public stopImgLoaderThread()V
    .locals 1

    .prologue
    .line 111
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;->imageManager:Lcom/opongo/blogapp/manager/ImageManager;

    invoke-virtual {v0}, Lcom/opongo/blogapp/manager/ImageManager;->stopThread()V

    .line 112
    return-void
.end method
